package com.depth.viewer.utils
{
	import flash.display.DisplayObject;
	
	import mx.core.FlexGlobals;
	import mx.core.IFlexDisplayObject;
	import mx.managers.PopUpManager;
	
	public class ProgressBarLoader
	{
		private static var loading:Boolean = false;
		public function ProgressBarLoader()
		{
		}
		public static function popupProgressBar(display:Boolean = true):void{
			if(display){
				if(loading)
					return;
				loading = true;
				MyProgressBar.instance.run();
				PopUpManager.addPopUp(MyProgressBar.instance as IFlexDisplayObject,FlexGlobals.topLevelApplication as DisplayObject);
			
			}else{
				if(loading){
					loading = false;
					MyProgressBar.instance.stop();
					PopUpManager.removePopUp(MyProgressBar.instance);
				}
			}
		}
	}
}